/**
 * <pre>
 * var cbx = new CQCIS.form.ArrayComboBox( {
 * 	ds : {
 * 		data : [[0, '女'], [1, '男'], [null, '未定']],
 * 		fields : [ {
 * 			name : 'sex',
 * 			type : 'int',
 * 			mapping : 0
 * 		}, {
 * 			name : 'desc',
 * 			mapping : 1
 * 		}]
 * 	},
 * 	emptyText : '请选择xx',
 * 	displayField : 'desc'
 * });
 * </pre>
 *
 * @author liuhz
 */
CQCIS.form.ArrayComboBox = Ext.extend(Ext.form.ComboBox, {
    /**
     * @cfg {Ext.data.ArrayStore} Ext.data.ArrayStore or config
     */
    /**
     * @cfg {emptyText} 为空时提示信息
     */
    /**
     * @cfg {displayField} 显示字段
     */
    /**
     * @cfg {valueField} 值字段
     */
    editable: false,
    typeAhead: false,
    triggerAction: 'all',
    selectOnFocus: true,
    mode: 'local',
    width: 100,
    valueField: 'key',
    displayField: 'label',
    resizable: true,
    
    initComponent: function(){
        if (this.ds instanceof Ext.data.Store) {
            this.store = this.ds;
            delete this.ds;
        } else {
            this.store = new Ext.data.SimpleStore({
                data: this.ds.data,
                fields: this.ds.fields ||
                ['key', 'label']
            });
            delete this.ds;
        }
        
        CQCIS.form.ArrayComboBox.superclass.initComponent.call(this);
    }
});
Ext.reg('acombo', CQCIS.form.ArrayComboBox);
